# -*- coding:utf-8 -*-
"""
Author：Administrator
Date:2023年02月23日
"""

import docx
from docx.shared import Cm,Pt
from docx.enum.text import WD_PARAGRAPH_ALIGNMENT

def fillCellColor(row,col,color):
	myElement='<w:shd {} w:fill="{color_value}"/>'
	myFormat=myElement.format(docx.oxml.ns.nsdecls('w'),color_value=color)
	myXML=docx.oxml.parse_xml(myFormat)
	myTable.cell(row,col)._tc.get_or_add_tcPr().append(myXML)

myDocument=docx.Document('新员工.docx')
myTable=myDocument.tables[0]
myColumn=myTable.add_column(docx.shared.Inches(1.2))
myItems=['最高学历','博士','硕士','硕士']
i=0
for i in range(len(myTable.rows)):
	for j in range(len(myTable.columns)):
		if i%2==0:
			fillCellColor(i,j,'#F5F5F5')
		else:
			fillCellColor(i,j,'#E0FFFF')

myDocument.save('02散文名篇.docx')


